<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?=$assessorInfo['assessor_name'];?>评分记录</title>
    <script src="jquery-1.9.1min.js"></script>
    <link rel="stylesheet" href="bootstrap.min.css">
    <script src="bootstrap.min.js"></script>
</head>
<style>
  table{
      border-collapse:collapse;
      table-layout:fixed;
      border-radius:5px;
      overflow:hidden;
      margin: 10px auto;
      border:2px solid #70aefb ;
      background-color: #1f5a9c;
      color: #fafafb;
  }
    table td,th{
        /* padding: 5px;
        width: 33%; */
        text-align: center;
        border:1px solid #70aefb ;
        vertical-align:middle;
        /* font-size: 15px; */
        width: 7rem;
    }
    a{
        color: red;
    }
    #edit div{
        margin-bottom: 10%;
    }
    label{
        width: 7rem;
    }
</style>
<body style="text-align: center;">
<table>
    <thead>
        <tr>
            <th>序号</th>
            <th>汇报者</th>
<!--            <th>PPT形象</th>-->
<!--            <th>个人形象</th>-->
<!--            <th>演讲台风</th>-->
<!--            <th>目标数据呈现</th>-->
<!--            <th>任务清单呈现</th>-->
<!--            <th>达成路径呈现</th>-->
<!--            <th>创新思维呈现</th>-->
            <th>总分</th>
            <th>排名</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
    <?php $index=1;foreach($list as $val):?>
        <tr>
            <td><?=$index;?></td>
            <td><?=$val['user_name'];?></td>
            <td id="<?=$val['id']?>score"><?=$val['score'];?></td>
<!--            <td id="<?=$val['id']?>original_first"><?=$val['original_first'];?></td>-->
<!--            <td id="<?=$val['id']?>original_second"><?=$val['original_second'];?></td>-->
<!--            <td id="<?=$val['id']?>original_third"><?=$val['original_third'];?></td>-->
<!--            <td id="<?=$val['id']?>original_fourth"><?=$val['original_fourth'];?></td>-->
<!--            <td id="<?=$val['id']?>original_fifth"><?=$val['original_fifth'];?></td>-->
<!--            <td id="<?=$val['id']?>original_sixth"><?=$val['original_sixth'];?></td>-->
<!--            <td id="<?=$val['id']?>original_seventh"><?=$val['original_seventh'];?></td>-->
            <td id="<?=$val['id']?>scoreSort"><?=$val['scoreSort'];?></td>
            <td>
                <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick="edit(<?=$val['id'];?>)">修改</button>
            </td>
        </tr>
    <?php $index++;endforeach;?>
    </tbody>
</table>

<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">

                <h4 class="modal-title" id="myModalLabel" style="text-align: center;width: 28rem;">
                    修改打分
                </h4>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
            </div>
            <div class="modal-body">
                <p>
                    <label>汇报者:</label>
                    <span id="user_name" style="color: red"></span>
                </p>

                <input type="hidden" id="score_id" value=""/>
                <div>
                    <label>PPT形象&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
                    <input id="original_first" value=""/>
                </div>
                <div>
                    <label>个人形象&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
                    <input id="original_second" value=""/>
                </div>
                <div>
                    <label>演讲台风&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
                    <input id="original_third" value=""/>
                </div>
                <div>
                    <label>目标数据呈现:</label>
                    <input id="original_fourth" value=""/>
                </div>
                <div>
                    <label>任务清单呈现:</label>
                    <input id="original_fifth" value=""/>
                </div>
                <div>
                    <label>达成路径呈现:</label>
                    <input id="original_sixth" value=""/>
                </div>
                <div>
                    <label>创新思维呈现:</label>
                    <input id="original_seventh" value=""/>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
                <button type="button" onclick="editsave()" class="btn btn-primary">
                    提交更改
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<a href="javascript:history.back(-1)" class="btn btn-primary btn-lg" role="button">返回</a>
</body>
</html>
<script>
    function edit(id) {
        // $('#myModal').css('display', 'block')
        $.ajax({url:"index.php",data:{
                'func':'edit',
                'id' : id
            },dataType:'json',success:function(result){
                if (result.code == '200'){
                    $('#user_name').text(result.data.user_name);
                    $('#score_id').val(result.data.id);
                    $('#original_first').val(result.data.original_first);
                    $('#original_second').val(result.data.original_second);
                    $('#original_third').val(result.data.original_third);
                    $('#original_fourth').val(result.data.original_fourth);
                    $('#original_fifth').val(result.data.original_fifth);
                    $('#original_sixth').val(result.data.original_sixth);
                    $('#original_seventh').val(result.data.original_seventh);
                }
            }});
    }
    
    function editsave() {
        var id = $('#score_id').val();
        var original_first = $('#original_first').val();
        var original_second = $('#original_second').val();
        var original_third = $('#original_third').val();
        var original_fourth = $('#original_fourth').val();
        var original_fifth = $('#original_fifth').val();
        var original_sixth = $('#original_sixth').val();
        var original_seventh = $('#original_seventh').val();
        var score = [
            original_first,
            original_second,
            original_third,
            original_fourth,
            original_fifth,
            original_sixth,
            original_seventh
        ];

        $.ajax({url:"index.php",data:{
                'func':'editsave',
                'id' : id,
                'score' : score
                // 'original_first':original_first,
                // 'original_second':original_second,
                // 'original_third':original_third,

            },dataType:'json',success:function(result){
                if (result.code == '200'){
                    alert(result.message);
                    window.location.reload()
                }
            }});
    }
</script>